package com.josework.springhelloworld.entity;

import java.util.Arrays;
import java.util.Collections;
import java.util.Hashtable;

public enum OrderStatusEnum {
    UN_PAID(0,"订单未支付"),
    PAIDED(1,"订单已支付"),
    SENDED(2,"已发货");

    private int index;

    private String desc;

    public int getIndex(){
        return index;
    }

    public String getDesc(){
        return desc;
    }

    OrderStatusEnum(int index,String desc){
        this.index = index;
        this.desc = desc;

    }


    static OrderStatusEnum of(int index){
        for (OrderStatusEnum temp : OrderStatusEnum.values()) {
            if (temp.getIndex() == index){
                return temp;
            }
        }
        return null;
    }


    public static void main(String[] args) {
        String statusString= OrderStatusEnum.of(1).getDesc();
        System.out.println(statusString);
        Integer i1 = 129;
        int i2 = 129;
        System.out.println((i1.equals(i2)));

    }


}
